package de.toolschmied.jjas.client.widgets.toolbar;

import com.google.gwt.user.client.ui.Image;


/**
 * An Action encapsulates a piece logic and allows you to add it
 * to a Toolbar. Basically a shortcut for adding a button to a toolbar.
 */
public abstract class Action {
	
	public enum Type {
		PUSH, TOGGLE, RADIO
	}
	
	private String name; 
	private String toolTip;
	private String imageURL;
	private Type type;
	private String group = null;

	public Action(String name) {
		this(name, null, null, Type.PUSH);
	}
		
	public Action(String name, String toolTip, String imageURL, Type type) {
		this.name = name;
		this.toolTip = toolTip;
		this.imageURL = imageURL;
		this.type = type;
	}
	
	public abstract void run();

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getToolTip() {
		return toolTip;
	}

	public void setToolTip(String toolTip) {
		this.toolTip = toolTip;
	}

	public String getImageURL() {
		return imageURL;
	}

	public void setImageURL(String imageURL) {
		this.imageURL = imageURL;
	}

	public Image getImage() {
		return new Image(imageURL);
	}

	public Type getType() {
		return type;
	}
	
	public void setType(Type type) {
		this.type = type;
	}

	public String getGroup() {
		return group;
	}

	public void setGroup(String group) {
		this.group = group;
	}
	
}
